package com.ems.buz;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import com.ems.bean.AlarmEvent;
import com.ems.bean.Dev;
import com.ems.bean.Item;
import com.ems.bean.Station;
import com.ems.bean.SystemOperateLog;
import com.ems.dao.AlarmEventDao;
import com.ems.dao.DevDao;
import com.ems.dao.ItemDao;
import com.ems.dao.StationDao;
import com.ems.dao.SystemOperateLogDao;
import com.ems.db.DbConn;
import com.ems.util.GetDate;
import com.ems.util.GetMsg;
import com.ems.util.GetUtil;
import com.ems.util.Page;


public class ItemBuz {
	
	private Connection conn;
	private ItemDao itemDao;
	private SystemOperateLogDao solDao;

	public ItemBuz() {
		conn = DbConn.getDbConn().getConn();
		itemDao = new ItemDao(conn);
		solDao = new SystemOperateLogDao(conn);
	}
	
	///cwd
	public List<Item> queryYtjExp(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryYtjExp(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public Page<Item> queryYtj(int machineId,int devInx,int itemInx,String startTime,String endTime,int pageSize,int toPage) throws SQLException {
		try {
			return itemDao.queryYtj(machineId, devInx, itemInx, startTime, endTime, pageSize, toPage);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryMtjExp(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryMtjExp(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public Page<Item> queryMtj(int machineId,int devInx,int itemInx,String startTime,String endTime,int pageSize,int toPage) throws SQLException {
		try {
			return itemDao.queryMtj(machineId, devInx, itemInx, startTime, endTime, pageSize, toPage);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryRtjExp(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryRtjExp(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public Page<Item> queryRtj(int machineId,int devInx,int itemInx,String startTime,String endTime,int pageSize,int toPage) throws SQLException {
		try {
			return itemDao.queryRtj(machineId, devInx, itemInx, startTime, endTime, pageSize, toPage);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryHisExp(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryExpHistory(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public Page<Item> query(int machineId,int devInx,int itemInx,String startTime,String endTime,int pageSize,int toPage) throws SQLException {
		try {
			return itemDao.queryHis(machineId, devInx, itemInx, startTime, endTime, pageSize, toPage);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryChart(int machineId,int devInx,int itemInx,String startTime,String endTime,int mode) throws SQLException {
		try {
			return itemDao.queryChart(machineId, devInx, itemInx, startTime, endTime, mode);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryHChart(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryHourChart(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryRChart(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryDayChart(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
	public List<Item> queryMChart(int machineId,int devInx,int itemInx,String startTime,String endTime) throws SQLException {
		try {
			return itemDao.queryMonChart(machineId, devInx, itemInx, startTime, endTime);			
		} finally {
			itemDao.closeAll();
		}
	}
}
